home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / movecurs / moveit.frm < prev   
Text File  |  1995-09-06  |  4KB  |  117 lines

  1. VERSION 2.00
  2. Begin Form moveit 
  3.    BorderStyle     =   3  'Fixed Double
  4.    Caption         =   "Cursor Position Example"
  5.    ClientHeight    =   6120
  6.    ClientLeft      =   1680
  7.    ClientTop       =   1605
  8.    ClientWidth     =   7245
  9.    Height          =   6525
  10.    Left            =   1620
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   6120
  15.    ScaleWidth      =   7245
  16.    Top             =   1260
  17.    Width           =   7365
  18.    Begin CommandButton Command4 
  19.       Caption         =   "Command4"
  20.       Height          =   525
  21.       Left            =   5490
  22.       TabIndex        =   3
  23.       Top             =   480
  24.       Width           =   1245
  25.    End
  26.    Begin CommandButton Command3 
  27.       Caption         =   "Command3"
  28.       Height          =   525
  29.       Left            =   5490
  30.       TabIndex        =   2
  31.       Top             =   5070
  32.       Width           =   1245
  33.    End
  34.    Begin CommandButton Command2 
  35.       Caption         =   "Command2"
  36.       Height          =   525
  37.       Left            =   540
  38.       TabIndex        =   1
  39.       Top             =   5070
  40.       Width           =   1245
  41.    End
  42.    Begin CommandButton Command1 
  43.       Caption         =   "Command1"
  44.       Height          =   525
  45.       Left            =   540
  46.       TabIndex        =   0
  47.       Top             =   480
  48.       Width           =   1245
  49.    End
  50. End
  51. Declare Sub ClientToScreen Lib "User" (ByVal hWnd As Integer, lpPoint As POINTAPI)
  52. Declare Sub SetCursorPos Lib "User" (ByVal X As Integer, ByVal Y As Integer)
  53.  
  54. Sub Command1_Click ()
  55.  Dim P As POINTAPI
  56.  SaveMode% = Me.ScaleMode
  57.  Me.ScaleMode = 3
  58.  P.X = Command2.Left + (Command2.Width) / 2
  59.  P.Y = Command2.Top + (Command2.Height) / 2
  60.  ClientToScreen Me.hWnd, P
  61.  SetCursorPos P.X, P.Y
  62.  Me.ScaleMode = SaveMode%
  63. End Sub
  64.  
  65. Sub Command2_Click ()
  66.  Dim P As POINTAPI
  67.  SaveMode% = Me.ScaleMode
  68.  Me.ScaleMode = 3
  69.  P.X = Command3.Left + (Command3.Width) / 2
  70.  P.Y = Command3.Top + (Command3.Height) / 2
  71.  ClientToScreen Me.hWnd, P
  72.  SetCursorPos P.X, P.Y
  73.  Me.ScaleMode = SaveMode%
  74. End Sub
  75.  
  76. Sub Command3_Click ()
  77.  Dim P As POINTAPI
  78.  SaveMode% = Me.ScaleMode
  79.  Me.ScaleMode = 3
  80.  P.X = Command4.Left + (Command4.Width) / 2
  81.  P.Y = Command4.Top + (Command4.Height) / 2
  82.  ClientToScreen Me.hWnd, P
  83.  SetCursorPos P.X, P.Y
  84.  Me.ScaleMode = SaveMode%
  85. End Sub
  86.  
  87. Sub Command4_Click ()
  88.  Dim P As POINTAPI
  89.  SaveMode% = Me.ScaleMode
  90.  Me.ScaleMode = 3
  91.  P.X = Command1.Left + (Command1.Width) / 2
  92.  P.Y = Command1.Top + (Command1.Height) / 2
  93.  ClientToScreen Me.hWnd, P
  94.  SetCursorPos P.X, P.Y
  95.  Me.ScaleMode = SaveMode%
  96. End Sub
  97.  
  98. Sub Form_Load ()
  99.  Dim Msg
  100.  Beep
  101.  Msg = "                Cursor Position Example" + Chr$(13)
  102.  Msg = Msg & "                 1993 by Mark Wisecarver" + Chr$(13) + Chr$(10)
  103.  Msg = Msg & Chr$(10) + "This will show you how to position" + Chr$(13)
  104.  Msg = Msg & Chr$(10) + "the cursor on your apps using API declarations." + Chr$(13) + Chr$(10)
  105.  Msg = Msg & Chr$(10) + "I can be reached via FrontDoor at 1:2380/410.0" + Chr$(13)
  106.  Msg = Msg & Chr$(10) + "or on CompuServe at 72400,505." + Chr$(13)
  107.  Msg = Msg & Chr$(10) + "________________________________________" + Chr$(13) + Chr$(10)
  108.  Msg = Msg & Chr$(10) + "The Visual Basic Depot, Mark Wisecarver" + Chr$(13)
  109.  Msg = Msg & Chr$(10) + "Flatrock, Michigan U.S.A." + Chr$(13)
  110.  MsgBox Msg
  111.   If WindowState = 0 Then
  112.     Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
  113.   End If
  114.   Show
  115. End Sub
  116.  
  117.